package com.right.health.app.ui.common;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.magic.basic.activity.BaseActivity;
import com.right.health.app.R;
import com.right.health.app.common.DataCommon;
import com.right.health.app.ui.common.adapter.SearchDepartmentAdapter;
import com.right.health.app.ui.common.adapter.SearchDoctorAdapter;
import com.right.health.app.ui.common.adapter.SearchHospitalAdapter;
import com.right.health.app.widget.ListViewEx;

/*
 * Created by hopeliao on 2019-10-02
 *
 */
public class SearchActivity extends BaseActivity {

    private SearchDoctorAdapter mDoctorAdapter;

    private SearchDepartmentAdapter mDepartmentAdapter;

    private SearchHospitalAdapter mHospitalAdapter;

    @Override
    public void onCreate(Bundle bundle, String s) {
        setContentView(R.layout.search);
    }

    @Override
    public void findView() {
        ListViewEx doctorListView = (ListViewEx) findViewById(R.id.doctor_list);
        mDoctorAdapter = new SearchDoctorAdapter(this);
        doctorListView.setAdapter(mDoctorAdapter);
        View doctorFooterView = LayoutInflater.from(this).inflate(R.layout.search_footer, null);
        doctorListView.addFooterView(doctorFooterView);

        ListViewEx departmentListView = (ListViewEx) findViewById(R.id.department_list);
        mDepartmentAdapter = new SearchDepartmentAdapter(this);
        departmentListView.setAdapter(mDepartmentAdapter);
        View departmentFooterView = LayoutInflater.from(this).inflate(R.layout.search_footer, null);
        TextView departmentMoreTv = (TextView) departmentFooterView.findViewById(R.id.tv_more);
        departmentMoreTv.setText("更多科室");
        departmentListView.addFooterView(departmentFooterView);

        ListViewEx hospitalList = (ListViewEx) findViewById(R.id.hospital_list);
        mHospitalAdapter = new SearchHospitalAdapter(this);
        hospitalList.setAdapter(mHospitalAdapter);
        View hospitalFooterView = LayoutInflater.from(this).inflate(R.layout.search_footer, null);
        TextView hospitalMoreTv = (TextView) hospitalFooterView.findViewById(R.id.tv_more);
        hospitalMoreTv.setText("更多医院");
        hospitalList.addFooterView(hospitalFooterView);
    }

    @Override
    public void initialize() {
        mDoctorAdapter.setDataSource(DataCommon.getTestDataSource());
        mDepartmentAdapter.setDataSource(DataCommon.getTestDataSource());
        mHospitalAdapter.setDataSource(DataCommon.getTestDataSource());
    }
}
